/*
 ============================================================================
 Name		: TradeBlockTransfer.h
 Author	  : Zhang Jiawei
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CTradeBlockTransfer declaration
 ============================================================================
 */

#ifndef TRADEBLOCKTRANSFERFUNDS_H
#define TRADEBLOCKTRANSFERFUNDS_H

// INCLUDES
#include "TradeBlock.h"
#include "Control.h"
#include "TradeBlockNetwork.h"

// CLASS DECLARATION
class CTradeBlockTransferFunds: public CTradeBlock, public MPushButtonObserver//, public MReqObserver
{    
public:
    ~CTradeBlockTransferFunds();

    static CTradeBlockTransferFunds* NewL(CBaseBlock* bsBack = NULL);

    static CTradeBlockTransferFunds* NewLC(CBaseBlock* bsBack);

private:
    CTradeBlockTransferFunds(CBaseBlock* bsBack);
    
    void ConstructL();

public:
    void OnDraw(CFbsBitGc& g) const;

    void OnKeyDown(TInt keyCode);

    void OnMouseDown(const TPoint& aPt);
    
    void OnMouseUp(const TPoint& aPt);
    
    void OnInput(const TDesC8& strInput);

    void SizeChanged();  
    
    void ChangeFocus(TBool aFoucs, const TInt& keyCode);
    
    void BeforeBack();
    
protected:
    void AddTabs();

    void BeforeDraw(CFbsBitGc& g) const;   
    
private:
    void CreateControls();
    void LayoutControls();
    void Transfer();
    void ResetData();
    
public:    
    // from MPushButtonObserver
    void PushButtonClicked();
    
public:
	TBool ProcessTradeNetworkMsg(TInt nError, TAny* p, const TDesC8& aBodyData);
	//TBool UpdateTradeNetwork(TInt nProgress);
		
private:
	enum TTransferControl
	{
		ETransferControl_SelectBoxMaster,
		ETransferControl_SelectBoxSupply,
		ETransferControl_SelectCurrency,
		ETransferControl_Amount,
		ETransferControl_Pwd,
		ETransferControl_ButtonConfirm,
		ETransferControl_ButtonReset,
		ETransferControlCount
	};
	
	enum TNetworkStatus
	{
		ENetworkStatus_None,
		ENetworkStatus_Req,
		ENetworkStatus_Resp
	};
private:
    CLabelSelectBox* iSelectBoxMaster;
    CLabelSelectBox* iSelectBoxSupply;
    CLabelSelectBox* iCurrencyEdit;
        
    CSingleLineTextInput* iAmountEdit;
    CSingleLineTextInput* iPwdEdit;
    
    CPushButton* iButtonConfirm;
    CPushButton* iButtonReset;
    
    CControl* iControls[ETransferControlCount];
    TInt iFocusControl;
    
    TInt	iNetworkStatus;
};

#endif // TRADEBLOCKTRANSFER_H
